<template>
  <div>
    <home-header :city="city"></home-header>
    <home-swiper :list="swiperList"></home-swiper>
    <home-icons :iconsList="iconsList"></home-icons>
    <home-recommend :recommendList = "recommendList"></home-recommend>
    <home-weekend :weekendList="weekendList"></home-weekend>
  </div>
</template>

<script>
import HomeHeader from './home/components/HomeHeader'
import HomeSwiper from './home/components/Swiper'
import HomeIcons from './home/components/HomeIcons'
import HomeRecommend from './home/components/HomeRecommend'
import HomeWeekend from './home/components/HomeWeekend'
export default {
  name: 'home',
  data () {
    return {
      city: "",
      swiperList: [],
      iconsList: [],
      recommendList: [],
      weekendList: []
    }
  },
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },
  methods: {
    getHomeInfo () {
       this.$axios.get('/api/index.json')
       .then(res => {
          console.log(res.data.data)
          const data = res.data.data
          this.city = data.city
          this.swiperList = data.SwiperList
          this.iconsList = data.iconList
          this.recommendList = data.recommendList
          this.weekendList = data.weekendList
       })
       .catch(err => {
         console.log('请求错误' + err)
       })
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style>

</style>
